package main

import (
	"fmt"
	"math"
)

func main() {
	value := maxValue(2, 3)
	fmt.Printf("最大数值是:%d\n", value)
	a, b := swap("hello", "world")
	fmt.Println(a, b)

	getSquareRoot := func(x float64) float64 {
		return math.Sqrt(x)
	}
	fmt.Println(getSquareRoot(11))
	nextNumber := getSequence()
	fmt.Println(nextNumber())
	fmt.Println(nextNumber())
	fmt.Println(nextNumber())
	nextNumber1 := getSequence()
	fmt.Println(nextNumber1())
	fmt.Println(nextNumber1())

	var c Circle
	c.radius = 10
	fmt.Println("圆的半径是:", c.radius)
	fmt.Println("面积是:", c.getArea())
}
func maxValue(a, b int) int {
	var result int
	if a > b {
		result = a
	} else {
		result = b
	}
	return result
}

func swap(x, y string) (string, string) {
	return y, x
}

func getSequence() func() int {
	i := 0
	return func() int {
		i++
		return i
	}
}

type Circle struct {
	radius float64
}

func (c Circle) getArea() float64 {
	return 3.14 * c.radius * c.radius
}
